import json

import pytest
import requests
import logging
def du_dl():
    with open("dl.json","r",encoding="utf8") as f:
        data=json.load(f)
        return data
class Test1():

    def setup_method(self):
        print("初始化环境")
    def teardown_method(self):
        print("结束用例")
    #登录
    @pytest.mark.parametrize("data",du_dl())
    def test_dl(self,data):
        try:
            url="http://10.59.9.12:7001/api/public/login"
            body={"username":data.get("username"),"password":data.get("password")}
            r=requests.post(url=url,json=body)
            print("登录成功",r.json())
            logging.info(r.json())
        except Exception as  e:
            logging.info(e)
            assert r.status_code==200

